<?php
include("food_conf.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>店家登录</title>
  <script language="javascript"> 
    function information()
    {
		var shop_ID = document.getElementById("shop_ID").value;
		var shop_pwd = document.getElementById("shop_pwd").value;
		if (shop_ID == "")
			{alert("店家编号不能为空！");}
		if (shop_pwd == "")
	        {alert("密码不能为空！");}
		if (shop_ID.length > 10)
			{alert("店家编号长度不能大于10字符！");}
		if (shop_pwd.length > 8)
			{alert("密码长度不能超过8个字符！");}
	}
</script>
 </head>
 <body>
  <form method="post" action="" onSubmit="return information()"> 
  <div align="center">店家编号：<br/>
<input type="text" name="shop_ID" value="店家编号在10字符以内" onFocus="if(value=='店家编号在10字符以内') {value=''}"><br/>
密 码：<br/>
<font size="1px">(密码在8字符以内)</font><br/>
<input type="password" name="shop_pwd"><br/>
<hr>
<input type="submit" name="submit" value="登 陆">
<input type="reset" name="reset" value="重 写">
</div>
</form>
</body>
</html>
<?php
if($_POST["submit"])
{
	$shop_ID = $_POST['shop_ID'];//获取编号
	$shop_pwd = $_POST['shop_pwd'];//获取密码

	$sql = "select * from shop where shop_ID='$shop_ID' and shop_pwd='$shop_pwd'";//验证编号、密码
	$result = mysql_query($sql,$conn) or die("<br/>".mysql_error());
	if (!mysql_num_rows($result))
	{
		echo '密码或店家编号错误，请重新输入！';
		exit;
	}
	Session_Start();
	$_SESSION["shop_ID"]="$shop_ID";

	echo "<script language=javascript>alert('登陆成功!');window.open('shop.php','_parent')</script>";
}
?>